#include "showwidget.h"

ShowWidget::ShowWidget(QWidget *parent) : QWidget(parent)
{
    setFixedSize(300,400);
    QPixmap WindowPix;
    WindowPix.load(":/res/bomb.png");
    this->setWindowIcon(QIcon(WindowPix));
    this->setWindowTitle("记录");

    //显示记录
    QTextEdit* show = new QTextEdit(this);
    show->setFixedSize(200,300);
    show->move(0.5*(this->width()-show->width()),0.5*(this->height()-show->height()));
    QFile file(".\\recode.txt");
    file.open(QIODevice::ReadOnly);
    QByteArray array = file.readAll();
    show->setText(array);
    file.close();

    //退出按钮
    QPushButton* exitBtn = new QPushButton(this);
    exitBtn->setFixedSize(60,30);
    exitBtn->setText("退出");
    exitBtn->move(this->width()-exitBtn->width(),this->height()-exitBtn->height());
    connect(exitBtn,&QPushButton::clicked,[=](){
        delete this;
    });
}
